﻿angular.module('app')
    .service('HolidaySrv', ['$http',
        function ($http) {
            return {
                //GET api/users/holiday/cgrant
                getUserHolidays: function (userName, year, timeout) {
                    return $http({ method: 'GET', url: 'api/users/holiday/' + userName, params: { year: year }, cache: false, timeout: timeout });
                },
                //POST api/users/holiday/cgrant
                applyHolidays: function (userName,dates, timeout) {
                    return $http({ method: 'POST', url: 'api/users/holiday/' + userName, data: dates, cache: false, headers: { 'Content-Type': 'application/json; charset=utf-8' }, timeout: timeout });
                },
                //PATCH api/workflows/start/?woid=&wcode=HolidayWf
                startHolidayWorkflow: function (data,params) {
                    return $http({ method: 'PATCH', url: 'api/workflows/start/', data: data, params: params, cache: false });
                }
            };
        }
    ]);